﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EasyTrader.Chart
{
    public partial class CPSvr8111SChartFrm : System.Windows.Forms.Form
    {
        private EasyTrader.Signal.TotalSignalManager m_GSignalManager = null;
        public EasyTrader.Signal.TotalSignalManager GSignalManager
        {
            get { return m_GSignalManager; }
            set { m_GSignalManager = value; }
        }

        public CPSvr8111SChartFrm()
        {
            InitializeComponent();
        }

        // Cybos Plus Data Set Member
        private ETDataSet m_CPDataSet = null;
        public EasyTrader.ETDataSet CPDataSet
        {
            get { return m_CPDataSet; }
            set { m_CPDataSet = value; }
        }
        private System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
        private void InitTimer()
        {
            timer.Interval = GlobalVar.ChartRefreshInterval;
            timer.Tick += new EventHandler(OnTimerTick);
            timer.Start();
        }

        // 여기서 차트를 갱신해 준다.
        private void OnTimerTick(object sender, EventArgs e)
        {
            // 차트에 데이터를 대응시켜 준다.
            if (GlobalVar.OperationMode == GlobalVar.OperationModeNormal)
            {
                SetChartData();
                ShowCurValue();
            }
            else
            {
                SetChartData(GlobalVar.SimulIndex);
                ShowCurValue(GlobalVar.SimulIndex);
            }
            SetForecastingYOnChart();
        }

        private void SetForecastingYOnChart()
        {
            if (m_GSignalManager == null)
                return;


            EasyTrader.Signal.ForecastingInfo foreInfo = GSignalManager.ProgramInfo;
            if (CPSvr8111SChartCtrl.Series["전체순매수예상가"] != null && foreInfo != null)
            {
                CPSvr8111SChartCtrl.Series["전체순매수예상가"].Points.Clear();
                CPSvr8111SChartCtrl.Series["전체순매수예상가"].Points.AddXY(foreInfo.StartX, foreInfo.StartY / 100);
                CPSvr8111SChartCtrl.Series["전체순매수예상가"].Points.AddXY(foreInfo.EndX, foreInfo.EndY / 100);
                txtAngle.Text = "현재각도 : " + foreInfo.Angle.ToString("F2");
            }
        }

        private void ShowCurValue()
        {
            // 데이터 셋 객체가 없으면 아무일도 하지 않는다.
            if (m_CPDataSet == null || GlobalVar.CPSvr8111SDataDownloaded == false)
                return;

            CPSvr8111STable dataTable = m_CPDataSet.GetCPSvr8111STable();
            int rowCount = dataTable.GetRowCount();
            if (rowCount == 0)
                return;

            DataRow row = dataTable.Rows[rowCount - 1];
            if (row["차익매수금액"] == DBNull.Value)
                return;

            double profitBuy = 0;
            double profitSell = 0;
            double nonArbitrageBuy = 0;
            double nonArbitrageSell = 0;
            double profitPureBuy = 0;
            double nonArbitragePureBuy = 0;
            double totalPureBuy = 0;

            profitBuy = Convert.ToDouble(row["차익매수금액"]) / 100;
            profitSell = Convert.ToDouble(row["차익매도금액"]) / 100;
            nonArbitrageBuy = Convert.ToDouble(row["비차익매수금액"]) / 100;
            nonArbitrageSell = Convert.ToDouble(row["비차익매도금액"]) / 100;
            profitPureBuy = profitBuy - profitSell;
            nonArbitragePureBuy = nonArbitrageBuy - nonArbitrageSell;
            totalPureBuy = profitPureBuy + nonArbitragePureBuy;
            string curTime = row["시각"].ToString();
            if (curTime != "0")
            {
                string minText = curTime.Substring(curTime.Length - 2, 2);
                string hourText = curTime.Substring(0, curTime.Length - 2);

                txtCurTime.Text = "현재시간 " + hourText + " : " + minText;
                txtCurPrice.Text = "현재 가격 : 전체 순매수 : " + totalPureBuy.ToString("F2");
            }
        }


        private void ShowCurValue(int a_CurIndex)
        {
            // 데이터 셋 객체가 없으면 아무일도 하지 않는다.
            if (m_CPDataSet == null)
                return;

            CPSvr8111STable dataTable = m_CPDataSet.GetCPSvr8111STable();
            int rowCount = dataTable.GetRowCount();
            if (rowCount == 0)
                return;

            DataRow row = dataTable.Rows[a_CurIndex];
            if (row["차익매수금액"] == DBNull.Value)
                return;

            double profitBuy = 0;
            double profitSell = 0;
            double nonArbitrageBuy = 0;
            double nonArbitrageSell = 0;
            double profitPureBuy = 0;
            double nonArbitragePureBuy = 0;
            double totalPureBuy = 0;

            profitBuy = Convert.ToDouble(row["차익매수금액"]) / 100;
            profitSell = Convert.ToDouble(row["차익매도금액"]) / 100;
            nonArbitrageBuy = Convert.ToDouble(row["비차익매수금액"]) / 100;
            nonArbitrageSell = Convert.ToDouble(row["비차익매도금액"]) / 100;
            profitPureBuy = profitBuy - profitSell;
            nonArbitragePureBuy = nonArbitrageBuy - nonArbitrageSell;
            totalPureBuy = profitPureBuy + nonArbitragePureBuy;
            string curTime = row["시각"].ToString();
            if (curTime != "0")
            {
                string minText = curTime.Substring(curTime.Length - 2, 2);
                string hourText = curTime.Substring(0, curTime.Length - 2);

                txtCurTime.Text = "현재시간 " + hourText + " : " + minText;
                txtCurPrice.Text = "현재 가격 : 전체 순매수 : " + totalPureBuy.ToString("F2");
            }
        }


        private void SetChartData()
        {
            // 데이터 셋 객체가 없으면 아무일도 하지 않는다.
            if (m_CPDataSet == null)
                return;

            CPSvr8111SChartCtrl.Series["차익매수"].Points.Clear();
            CPSvr8111SChartCtrl.Series["차익매도"].Points.Clear();
            CPSvr8111SChartCtrl.Series["비차익매수"].Points.Clear();
            CPSvr8111SChartCtrl.Series["비차익매도"].Points.Clear();
            CPSvr8111SChartCtrl.Series["차익순매수"].Points.Clear();
            CPSvr8111SChartCtrl.Series["비차익순매수"].Points.Clear();
            CPSvr8111SChartCtrl.Series["전체순매수"].Points.Clear();
            CPSvr8111STable dataTable = m_CPDataSet.GetCPSvr8111STable();
            //double maxValue = -10000.0;
            //double minValue = 10000.0;
            int rowCount = dataTable.GetRowCount();
            if (rowCount == 0)
                return;

            //int minIndex = 0;
            //int maxIndex = 0;
            double profitBuy = 0;
            double profitSell = 0;
            double nonArbitrageBuy = 0;
            double nonArbitrageSell = 0;
            double profitPureBuy = 0;
            double nonArbitragePureBuy = 0;
            double totalPureBuy = 0;
            for (int i = 0; i < rowCount; i++)
            {
                DataRow row = dataTable.Rows[i];
                try
                {
                    // 값이 없을 경우는 넘어 간다.
                    if (row["차익매수금액"] == DBNull.Value)
                        continue;

                    profitBuy = Convert.ToDouble(row["차익매수금액"]) / 100;
                    profitSell = Convert.ToDouble(row["차익매도금액"]) / 100;
                    nonArbitrageBuy = Convert.ToDouble(row["비차익매수금액"]) / 100;
                    nonArbitrageSell = Convert.ToDouble(row["비차익매도금액"]) / 100;
                    CPSvr8111SChartCtrl.Series["차익매수"].Points.AddXY(i, profitBuy);
                    CPSvr8111SChartCtrl.Series["차익매도"].Points.AddXY(i, profitSell);
                    CPSvr8111SChartCtrl.Series["비차익매수"].Points.AddXY(i, nonArbitrageBuy);
                    CPSvr8111SChartCtrl.Series["비차익매도"].Points.AddXY(i, nonArbitrageSell);
                    profitPureBuy = profitBuy - profitSell;
                    CPSvr8111SChartCtrl.Series["차익순매수"].Points.AddXY(i, profitPureBuy);
                    nonArbitragePureBuy = nonArbitrageBuy - nonArbitrageSell;
                    CPSvr8111SChartCtrl.Series["비차익순매수"].Points.AddXY(i, nonArbitragePureBuy);
                    totalPureBuy = profitPureBuy + nonArbitragePureBuy;
                    CPSvr8111SChartCtrl.Series["전체순매수"].Points.AddXY(i, totalPureBuy);
                    CPSvr8111SChartCtrl.Series["전체순매수"].Points[i].XValue = i;
                    //CPSvr8111SChartCtrl.Series["전체순매수"].Points[i].AxisLabel = row["시각"].ToString();
                    int hour = Convert.ToInt32(row["시각"]);
                    if (hour != 0)
                        CPSvr8111SChartCtrl.Series["전체순매수"].Points[i].AxisLabel = row["시각"].ToString();
                    else
                        CPSvr8111SChartCtrl.Series["전체순매수"].Points[i].AxisLabel = GlobalVar.DayIndexToTime(i).ToString();
                    
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }

            /*
            int valueHeight = (int)(maxValue - minValue) / 500;
            maxValue = valueHeight * 500 + 500;

            if (maxValue >= minValue)
            {
                CPSvr8111SChartCtrl.ChartAreas["price"].AxisY.Minimum = minValue;
                CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.Maximum = maxValue;
            }*/
        }

        private void SetChartData(int a_CurIndex)
        {
            // 데이터 셋 객체가 없으면 아무일도 하지 않는다.
            if (m_CPDataSet == null)
                return;

            CPSvr8111SChartCtrl.Series["차익매수"].Points.Clear();
            CPSvr8111SChartCtrl.Series["차익매도"].Points.Clear();
            CPSvr8111SChartCtrl.Series["비차익매수"].Points.Clear();
            CPSvr8111SChartCtrl.Series["비차익매도"].Points.Clear();
            CPSvr8111SChartCtrl.Series["차익순매수"].Points.Clear();
            CPSvr8111SChartCtrl.Series["비차익순매수"].Points.Clear();
            CPSvr8111SChartCtrl.Series["전체순매수"].Points.Clear();
            CPSvr8111STable dataTable = m_CPDataSet.GetCPSvr8111STable();
            //double maxValue = -10000.0;
            //double minValue = 10000.0;
            int rowCount = dataTable.GetRowCount();
            if (rowCount == 0)
                return;
            if (rowCount - 1 < a_CurIndex)
                return;

            //int minIndex = 0;
            //int maxIndex = 0;
            double profitBuy = 0;
            double profitSell = 0;
            double nonArbitrageBuy = 0;
            double nonArbitrageSell = 0;
            double profitPureBuy = 0;
            double nonArbitragePureBuy = 0;
            double totalPureBuy = 0;
            for (int i = 0; i <= a_CurIndex; i++)
            {
                DataRow row = dataTable.Rows[i];
                try
                {
                    // 값이 없을 경우는 넘어 간다.
                    if (row["차익매수금액"] == DBNull.Value)
                        continue;

                    profitBuy = Convert.ToDouble(row["차익매수금액"]) / 100;
                    profitSell = Convert.ToDouble(row["차익매도금액"]) / 100;
                    nonArbitrageBuy = Convert.ToDouble(row["비차익매수금액"]) / 100;
                    nonArbitrageSell = Convert.ToDouble(row["비차익매도금액"]) / 100;
                    CPSvr8111SChartCtrl.Series["차익매수"].Points.AddXY(i, profitBuy);
                    CPSvr8111SChartCtrl.Series["차익매도"].Points.AddXY(i, profitSell);
                    CPSvr8111SChartCtrl.Series["비차익매수"].Points.AddXY(i, nonArbitrageBuy);
                    CPSvr8111SChartCtrl.Series["비차익매도"].Points.AddXY(i, nonArbitrageSell);
                    profitPureBuy = profitBuy - profitSell;
                    CPSvr8111SChartCtrl.Series["차익순매수"].Points.AddXY(i, profitPureBuy);
                    nonArbitragePureBuy = nonArbitrageBuy - nonArbitrageSell;
                    CPSvr8111SChartCtrl.Series["비차익순매수"].Points.AddXY(i, nonArbitragePureBuy);
                    totalPureBuy = profitPureBuy + nonArbitragePureBuy;
                    CPSvr8111SChartCtrl.Series["전체순매수"].Points.AddXY(i, totalPureBuy);
                    CPSvr8111SChartCtrl.Series["전체순매수"].Points[i].XValue = i;
                    //CPSvr8111SChartCtrl.Series["전체순매수"].Points[i].AxisLabel = row["시각"].ToString();
                    int hour = Convert.ToInt32(row["시각"]);
                    if (hour != 0)
                        CPSvr8111SChartCtrl.Series["전체순매수"].Points[i].AxisLabel = row["시각"].ToString();
                    else
                        CPSvr8111SChartCtrl.Series["전체순매수"].Points[i].AxisLabel = GlobalVar.DayIndexToTime(i).ToString();

                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }
        }

        private void InitControl()
        {
            cbProfitBuy.Checked = false;
            cbProfitSell.Checked = false;
            cbNonArbitrageBuy.Checked = false;
            cbNonArbitrageSell.Checked = false;
            cbProfitPureBuy.Checked = true;
            cbNonArbitragePureBuy.Checked = true;
            cbTotalPureBuy.Checked = true;
            cbFore.Checked = true;
            CPSvr8111SChartCtrl.Series["차익매수"].Enabled = false;
            CPSvr8111SChartCtrl.Series["차익매도"].Enabled = false;
            CPSvr8111SChartCtrl.Series["비차익매수"].Enabled = false;
            CPSvr8111SChartCtrl.Series["비차익매도"].Enabled = false;

            CPSvr8111SChartCtrl.Series["차익순매수"].ToolTip = "#VALX : #VAL";
            CPSvr8111SChartCtrl.Series["비차익순매수"].ToolTip = "#VALX : #VAL";
            CPSvr8111SChartCtrl.Series["전체순매수"].ToolTip = "#VALX : #VAL";
            CPSvr8111SChartCtrl.Series["차익매수"].ToolTip = "#VALX : #VAL";
            CPSvr8111SChartCtrl.Series["차익매도"].ToolTip = "#VALX : #VAL";
            CPSvr8111SChartCtrl.Series["비차익매수"].ToolTip = "#VALX : #VAL";
            CPSvr8111SChartCtrl.Series["비차익매도"].ToolTip = "#VALX : #VAL";
            CPSvr8111SChartCtrl.Series["전체순매수예상가"].ToolTip = "#VALX : #VAL";
        }

        public CPSvr8111SChartFrm(ETDataSet a_DataSet)
        {
            InitializeComponent();
            m_CPDataSet = a_DataSet;
            InitControl();
        }

        private void InitChart()
        {
            CPSvr8111SChartCtrl.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(211)), ((System.Byte)(223)), ((System.Byte)(240)));
            CPSvr8111SChartCtrl.BackSecondaryColor = System.Drawing.Color.White;
            CPSvr8111SChartCtrl.BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
            CPSvr8111SChartCtrl.BorderlineColor = System.Drawing.Color.FromArgb(((System.Byte)(26)), ((System.Byte)(59)), ((System.Byte)(105)));
            CPSvr8111SChartCtrl.BorderlineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Solid;
            CPSvr8111SChartCtrl.BorderlineWidth = 2;
            CPSvr8111SChartCtrl.BorderSkin.SkinStyle = System.Windows.Forms.DataVisualization.Charting.BorderSkinStyle.Emboss;

            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisX.MajorGrid.Interval = 10;
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisX.Interval = 10;
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.MajorGrid.Interval = 1000;
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.MinorGrid.Interval = 500;
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.Interval = 500;

            CPSvr8111SChartCtrl.ChartAreas["Price"].Area3DStyle.IsClustered = true;
            CPSvr8111SChartCtrl.ChartAreas["Price"].Area3DStyle.Perspective = 10;
            CPSvr8111SChartCtrl.ChartAreas["Price"].Area3DStyle.IsRightAngleAxes = false;
            CPSvr8111SChartCtrl.ChartAreas["Price"].Area3DStyle.WallWidth = 0;
            CPSvr8111SChartCtrl.ChartAreas["Price"].Area3DStyle.Inclination = 15;
            CPSvr8111SChartCtrl.ChartAreas["Price"].Area3DStyle.Rotation = 10;
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisX.IsLabelAutoFit = true;
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisX.LabelStyle.IsEndLabelVisible = false;
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisX.LineColor = System.Drawing.Color.FromArgb(((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)));
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisX.MajorGrid.LineColor = System.Drawing.Color.FromArgb(((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)));
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.IsLabelAutoFit = true;
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.LineColor = System.Drawing.Color.FromArgb(((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)));
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.MajorGrid.LineColor = System.Drawing.Color.FromArgb(((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)));
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.IsStartedFromZero = false;
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.MinorGrid.LineColor = System.Drawing.Color.FromArgb(((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)));
            CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.MinorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.DashDot;

            //CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.LabelAutoFitMaxFontSize;
            CPSvr8111SChartCtrl.ChartAreas["Price"].BackColor = System.Drawing.Color.FromArgb(((System.Byte)(64)), ((System.Byte)(165)), ((System.Byte)(191)), ((System.Byte)(228)));
            CPSvr8111SChartCtrl.ChartAreas["Price"].BackSecondaryColor = System.Drawing.Color.White;
            CPSvr8111SChartCtrl.ChartAreas["Price"].BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom;
            CPSvr8111SChartCtrl.ChartAreas["Price"].BorderColor = System.Drawing.Color.FromArgb(((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)), ((System.Byte)(64)));
            CPSvr8111SChartCtrl.ChartAreas["Price"].BorderDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Solid;
            CPSvr8111SChartCtrl.ChartAreas["Price"].Position.Auto = true;
            //CPSvr8111SChartCtrl.ChartAreas["Price"].Position.Height = 80F;
            //CPSvr8111SChartCtrl.ChartAreas["Price"].Position.Width = 80F;
            //CPSvr8111SChartCtrl.ChartAreas["Price"].Position.X = 5F;
            //CPSvr8111SChartCtrl.ChartAreas["Price"].Position.Y = 10F;
            CPSvr8111SChartCtrl.ChartAreas["Price"].ShadowColor = System.Drawing.Color.Transparent;
            
            
            //CPSvr8111SChartCtrl.Series["지수"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
             

            //CPSvr8111SChartCtrl.Series[0]["PriceUpColor"] = "blue";
            //CPSvr8111SChartCtrl.Series[0]["PriceDownColor"] = "Red";
            //CPSvr8111SChartCtrl.ChartAreas["Price"].AxisX.LabelStyle.IsEndLabelVisible = true;
            //CPSvr8111SChartCtrl.ChartAreas["Price"].AxisX.IsMarginVisible = true;
            //CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.LabelStyle.IsEndLabelVisible = true;
            //CPSvr8111SChartCtrl.ChartAreas["Price"].AxisY.IsMarginVisible = true;
            //CPSvr8111SChartCtrl.Series[0].Color = Color.Red;
            //DataPointCustomProperties aa = CPSvr8111SChartCtrl.Series[0]["PriceUpColor"];

            //CPSvr8111SChartCtrl.Series["투신"].Enabled = false;
            //CPSvr8111SChartCtrl.Series["연기금"].Enabled = false;
            //CPSvr8111SChartCtrl.Series["국가"].Enabled = false;
            System.Windows.Forms.DataVisualization.Charting.StripLine stripLine = new System.Windows.Forms.DataVisualization.Charting.StripLine();
            stripLine.Interval = 0;
            stripLine.IntervalOffset = 0;
            stripLine.BackColor = Color.Black;
            stripLine.StripWidth = 1.0;
            stripLine.Text = "기준선";
            CPSvr8111SChartCtrl.ChartAreas[0].AxisY.StripLines.Add(stripLine);

        }

        private void CPSvr8111SChart_Load(object sender, EventArgs e)
        {
            InitChart();
            InitTimer();
        }

        private void CPSvr8111SChart_FormClosing(object sender, FormClosingEventArgs e)
        {
            timer.Stop();
        }

        private void cbProfitBuy_CheckedChanged(object sender, EventArgs e)
        {
            if (cbProfitBuy.Checked)
            {
                CPSvr8111SChartCtrl.Series["차익매수"].Enabled = true;
            }
            else
            {
                CPSvr8111SChartCtrl.Series["차익매수"].Enabled = false;
            }
        }

        private void cbProfitSell_CheckedChanged(object sender, EventArgs e)
        {
            if (cbProfitSell.Checked)
            {
                CPSvr8111SChartCtrl.Series["차익매도"].Enabled = true;
            }
            else
            {
                CPSvr8111SChartCtrl.Series["차익매도"].Enabled = false;
            }
        }

        private void cbNonArbitrageBuy_CheckedChanged(object sender, EventArgs e)
        {
            if (cbNonArbitrageBuy.Checked)
            {
                CPSvr8111SChartCtrl.Series["비차익매수"].Enabled = true;
            }
            else
            {
                CPSvr8111SChartCtrl.Series["비차익매수"].Enabled = false;
            }
        }

        private void cbNonArbitrageSell_CheckedChanged(object sender, EventArgs e)
        {
            if (cbNonArbitrageSell.Checked)
            {
                CPSvr8111SChartCtrl.Series["비차익매도"].Enabled = true;
            }
            else
            {
                CPSvr8111SChartCtrl.Series["비차익매도"].Enabled = false;
            }
        }

        private void cbProfitPureBuy_CheckedChanged(object sender, EventArgs e)
        {
            if (cbProfitPureBuy.Checked)
            {
                CPSvr8111SChartCtrl.Series["차익순매수"].Enabled = true;
            }
            else
            {
                CPSvr8111SChartCtrl.Series["차익순매수"].Enabled = false;
            }
        }

        private void cbNonArbitragePureBuy_CheckedChanged(object sender, EventArgs e)
        {
            if (cbNonArbitragePureBuy.Checked)
            {
                CPSvr8111SChartCtrl.Series["비차익순매수"].Enabled = true;
            }
            else
            {
                CPSvr8111SChartCtrl.Series["비차익순매수"].Enabled = false;
            }
        }

        private void cbTotalPureBuy_CheckedChanged(object sender, EventArgs e)
        {
            if (cbTotalPureBuy.Checked)
            {
                CPSvr8111SChartCtrl.Series["전체순매수"].Enabled = true;
            }
            else
            {
                CPSvr8111SChartCtrl.Series["전체순매수"].Enabled = false;
            }
        }

        private void cbFore_CheckedChanged(object sender, EventArgs e)
        {
            if (cbFore.Checked)
            {
                CPSvr8111SChartCtrl.Series["전체순매수예상가"].Enabled = true;
            }
            else
            {
                CPSvr8111SChartCtrl.Series["전체순매수예상가"].Enabled = false;
            }
        }
    }
}
